package com.study.shengsiyuan.example04;

import java.util.concurrent.TimeUnit;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;

public class MyHeartbeatServerInitializer extends ChannelInitializer<SocketChannel> {

	@Override
	protected void initChannel(SocketChannel ch) throws Exception {
		ChannelPipeline pl = ch.pipeline(); //连接所有处理器
		pl.addLast(new IdleStateHandler(1, 2, 3,TimeUnit.SECONDS))//空闲状态检测
			.addLast(new MyHeartbeatServerHandler());
	}

}
